<template>
  <div class="currency-details">
    <div class="details-head">
      <div class="head-top">
        <div class="black-box"></div>
        <span>{{ biTitle }}</span>
      </div>
      <div class="head-cen">
        <span class="num">0.02</span>
        <span class="bif">{{ biTitle }}</span>
      </div>
    </div>
    <van-tabs v-model:active="active">
      <van-tab title="全部"></van-tab>
      <van-tab title="提现"></van-tab>
      <van-tab title="充值"></van-tab>
      <van-tab title="交易"></van-tab>
    </van-tabs>

    <div class="list-box">
      <van-list
          v-model:loading="loading"
          :finished="finished"
          finished-text="没有更多了"
          @load="onLoad"
      >
        <div class="list-inner" v-for="item in 40" :key="item">
          <span class="time">2023/08/24 15:00</span>
          <span class="type">提现</span>
          <span class="numb">-200{{ biTitle }}</span>
        </div>
      </van-list>
    </div>
  </div>
</template>
<script setup>
import {useRoute} from "vue-router";
import {ref, onMounted} from "vue";

const route = useRoute();
const biTitle = ref('');
const active = ref(0);
const list = ref([]);
const loading = ref(false);
const finished = ref(false);

const onLoad = () => {
  // 异步更新数据
  // setTimeout 仅做示例，真实场景中一般为 ajax 请求
  setTimeout(() => {
    for (let i = 0; i < 10; i++) {
      list.value.push(list.value.length + 1);
    }

    // 加载状态结束
    loading.value = false;

    // 数据全部加载完成
    if (list.value.length >= 40) {
      finished.value = true;
    }
  }, 1000);
};
onMounted(() => {
  switch (route.query.type) {
    case '1':
      window.document.title = 'USDT';
      biTitle.value = 'USDT';
      break;
    case '2':
      window.document.title = 'AVM';
      biTitle.value = 'AVM';
      break;

    default:
      break;
  }
})
</script>
<style scoped lang="scss">
.currency-details {
  max-height: 100vh;
  padding-top: 13px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;

  .details-head {
    background: url('@/assets/images/border-bg2.png') no-repeat;
    background-size: 100% 100%;
    margin: 0 15px 26px;
    padding: 23px 30px;

    .head-top {
      display: flex;
      align-items: center;
      font-size: 15px;
      color: #FBF5F5;

      .black-box {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background-color: black;
        border: 1px solid #FFFFFF;
        margin-right: 10px;
      }
    }

    .head-cen {
      display: flex;
      align-items: end;
      color: #F7AC15;
      margin: 17px 0 21px 0;

      .num {
        font-size: 21px;
        margin-right: 8px;
      }

      .bif {
        font-size: 13px;
      }
    }

    .head-bot {
      display: flex;
      align-items: center;

      .bot-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        color: #000;
        padding: 6px 10px;
        background: linear-gradient(270deg, #EBFC8C 0%, #ACEAA7 100%);
        border-radius: 30px;
        margin-right: 30px;
      }
    }
  }

  .list-box {
    flex: 1;
    overflow: scroll;

    .list-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 14px;
      color: #F6F6F6;
      padding: 0 32px 0 23px;
      margin-top: 20px;
    }
  }
}

:deep(.van-tabs__nav--line) {
  width: 80%;
  background-color: rgba(255, 0, 0, 0);
}

:deep(.van-tab--line) {
  font-size: 15px;
  color: #FBF5F5;
}

:deep(.van-tab--active) {
  font-size: 18px;
  color: #F7AC15;
}

:deep(.van-tabs__line) {
  height: 5px;
  background: #F7AC15;
}
</style>
